#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;

class Solution {
public:
    int pivotIndex(vector<int>& nums) {
        if(nums.empty()){
            return -1;
        }
        int i = 0;
        int j = nums.size()-1;
        int leftSum = 0;
        int rightSum = 0;
       for(int index = 0;index<nums.size();++index){
           leftSum = accumulate(nums.begin(),nums.begin()+index,0);
           rightSum = accumulate(nums.begin()+index+1,nums.end(),0);
           if(rightSum==leftSum){
               return index;
           }
       }
       return -1;
    }
};

int main(){
    Solution S;
    vector<int> nums = {-1,-1,-1,-1,-1,0};
    cout<<S.pivotIndex(nums)<<endl;
}